package com.payment.mapper;

import com.payment.bean.Payment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Description:
 *
 * @author weiruibai.vendor
 * Date: 2022/12/12 17:56
 */
@Mapper
public interface PaymentDao {

    @Insert("insert into t_payment (user_id,amount,name,create_at) values (#{userId},#{amount},#{name},#{createAt})")
    Integer add(Payment payment);

    @Select("select id ,user_id as userId,amount as amount , name as name ,create_at as createAt from t_payment where id = #{id}")
    Payment get(@Param("id") int id);

    @Select("select id ,user_id as userId,amount as amount , name as name ,create_at as createAt from t_payment")
    List<Payment> getList();
}
